package com.javax.naming;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

public class NamingClient {
	public static void main(String[] args) {
		try {
			String url = "rmi://192.168.10.42:6666/REGISTER";
			RegisterServerIFC register = (RegisterServerIFC) Naming.lookup(url);
			System.out.println(register.registerServer());

			System.out.println("初始数据:\t" + register.getPhone().toString());
			register.setPhoneName("Smartisan T1 坚果");
			System.out.println("修改后数据:\t" + register.getPhone().toString());

		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NotBoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
